fix: Trash enumerates only locally trashed items.#140
Merged
Conversation
Collaborator
i2h3
commented
Jan 14, 2026
- Introduced new schema property wasTrashedLocally on SendableItemMetadata.
- Added corresponding schema version and migration.
- Extended related data models accordingly.
- Updated Enumerator to no longer enumerate remote trash items based on wasTrashedLocally.
Contributor
There was a problem hiding this comment.
Pull request overview
This pull request adds a new wasTrashedLocally boolean property to track whether items were trashed on the local device versus on the server or another client. The intent is to exclude remote trash items from trash container enumeration, showing only locally trashed items to users.
Changes:
- Added
wasTrashedLocallyproperty to ItemMetadata protocol, RealmItemMetadata, and SendableItemMetadata with schema migration - Updated extension methods to accept and pass through the
wasTrashedLocallyparameter - Modified Item+Trash.swift to set
wasTrashedLocally: truewhen trashing items locally andwasTrashedLocally: falsewhen restoring items - Changed Enumerator+Trash.swift to skip enumerating remote trash items
Reviewed changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| Sources/NextcloudFileProviderKit/Metadata/ItemMetadata.swift | Added wasTrashedLocally property to protocol |
| Sources/NextcloudFileProviderKit/Metadata/RealmItemMetadata.swift | Added persisted wasTrashedLocally property with default value false |
| Sources/NextcloudFileProviderKit/Metadata/SendableItemMetadata.swift | Added wasTrashedLocally property with documentation and updated initializers |
| Sources/NextcloudFileProviderKit/Database/SchemaVersion.swift | Added new schema version for wasTrashedLocally |
| Sources/NextcloudFileProviderKit/Database/FilesDatabaseManager.swift | Added migration logic, updated schema version, fixed logging inconsistency |
| Sources/NextcloudFileProviderKit/Extensions/NKTrash+Extensions.swift | Added wasTrashedLocally parameter to toItemMetadata with documentation |
| Sources/NextcloudFileProviderKit/Extensions/NKFile+Extensions.swift | Added wasTrashedLocally parameter to toItemMetadata |
| Sources/NextcloudFileProviderKit/Item/Item.swift | Updated placeholder item creation to include wasTrashedLocally: false |
| Sources/NextcloudFileProviderKit/Item/Item+Trash.swift | Set wasTrashedLocally: true for locally trashed items, false for restored items, improved logging |
| Sources/NextcloudFileProviderKit/Item/Item+Create.swift | Updated item creation to include wasTrashedLocally: false |
| Sources/NextcloudFileProviderKit/Item/Item+LockFile.swift | Updated lock file creation to include wasTrashedLocally: false |
| Sources/NextcloudFileProviderKit/Item/Item+Ignored.swift | Updated ignored file creation to include wasTrashedLocally: false |
| Sources/NextcloudFileProviderKit/Item/Item+Modify.swift | Formatting improvements and code cleanup |
| Sources/NextcloudFileProviderKit/Enumeration/Enumerator+Trash.swift | Modified to skip enumerating remote trash items, added documentation and debug logging |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Sources/NextcloudFileProviderKit/Enumeration/Enumerator+Trash.swift
Outdated
Show resolved
Hide resolved
Sources/NextcloudFileProviderKit/Enumeration/Enumerator+Trash.swift
Outdated
Show resolved
Hide resolved
Sources/NextcloudFileProviderKit/Enumeration/Enumerator+Trash.swift
Outdated
Show resolved
Hide resolved
fd6a502 to
be059e4
Compare
- Introduced new schema property wasTrashedLocally on SendableItemMetadata. - Added corresponding schema version and migration. - Extended related data models accordingly. - Updated Enumerator to no longer enumerate remote trash items based on wasTrashedLocally. Signed-off-by: Iva Horn <iva.horn@nextcloud.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.